/*
 * Group 3, User Interface Programming II (vt11)
 * Pooya | Flora | Monica | Can
 */
package vical.undo;

import javax.swing.text.JTextComponent;

/**
 * The undoable event for oldText editing.
 * 
 * @author Can
 */
public abstract class UndoableTextEvent implements IUndoableEvent {

    protected String oldText;
    protected String newText;
    protected JTextComponent textComponent;
    protected int selectionStart;
    protected int selectionEnd;

    public UndoableTextEvent(String oldText, String newText, JTextComponent textComponent) {
        this.oldText = oldText;
        this.newText = newText;
        this.textComponent = textComponent;
        this.selectionStart = textComponent.getSelectionStart();
        this.selectionEnd = textComponent.getSelectionEnd();
    }

    public abstract void reexecute();

    public abstract void unexecute();
}
